package com.jp.weixin.receive.controller;

import java.io.IOException;
import java.io.Writer;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("/receive")
public class ReceiveController {
	
	/**
	 * 接收微信平台以get返回信息
	 */
	@RequestMapping(path="/msg", method=RequestMethod.GET)
	public void doGet(@RequestParam(name="signature", required=false) String signature,
			@RequestParam(name="timestamp", required=false) String timestamp,
			Writer writer) throws IOException{
		writer.write("hello get " + signature); //写页面响应内容
	}
	
	
	/**
	 * 接收微信平台以get返回信息
	 */
	@RequestMapping(path="/msg", method=RequestMethod.POST)
	public void doPost(){
		System.out.println("hello post");
	}

}
